package com.shiro.test.mvc.util;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.DeploymentBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Administrator on 2020/12/1 0001.
 * 发布流程工具类
 */
public class ActivitiUtil {

    public static void main(String[] args) {
        ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:spring-activiti.xml");
        ProcessEngine processEngine = (ProcessEngine) ac.getBean("processEngine");
        RepositoryService repositoryService = processEngine.getRepositoryService();
        Deployment deployment = repositoryService.createDeployment().name("请假条").addClasspathResource("leave_tips.bpmn").deploy();
        System.out.println(deployment.getId());
    }
}
